#if !defined( OPEN_STREAM_NAME_WITH_SUBSTITUTIONS_H)
#define  OPEN_STREAM_NAME_WITH_SUBSTITUTIONS_H
#include <string>
#include <vector>
#include <fstream>
#include <utility>
#include <map>

// open stream with a file name constructed from
// the original fullpath and a format string
// The format string can contain
//		[FILENAME]		= filename
//		[EXT]			= extension including dot
//		[PATH]			= path including final slash
// 	all parsed from the original fullpath	

// 	as well as additional parameters in square brackets supplied in pairs.
//	For each pair, the second string is substituted for all instances of the first
// 		string. 
// 		E.g. 
// 			with custom			=  <"[SPECIES]", "dog">
// 			and  original_path	=	a_long/path/wierd_name.fa
// 			and	 format			= [EXT]/[SPECIES]_[PATH][SPECIES]/[FILE][EXT]
// 				becomes			:	fa/dog_a_long/path/dog/wierd_name.fa

void open_stream_with_substitutions(	std::ofstream& 		ostrm,
										std::string& 		new_file_name,
										const std::string& format,
										const std::string& original_path,
										const std::map<std::string, std::string>& custom_replacements = 
																std::map<std::string, std::string>());

std::string get_file_name_substitutions(	std::string 		format,
											const std::string&	original_path,
											const std::map<std::string, std::string>& custom_replacements = 
																std::map<std::string, std::string>());

#endif	//OPEN_STREAM_NAME_WITH_SUBSTITUTIONS_H

